-
Notifications
You must be signed in to change notification settings - Fork 109
[custom channels]: Assert fix for duplicate script key issues in MPP payments #908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[custom channels]: Assert fix for duplicate script key issues in MPP payments #908
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm!
itest/litd_custom_channels_test.go
Outdated
| // active. | ||
| numHtlcs := 4 | ||
| if mpp { | ||
| numHtlcs += 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could derive the numHtlcs from invoice amt + default max shard size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, makes sense. That way we can also more easily increase the number of HTLCs later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - confirmed MPP behavior from peeking at the logs 💯
itest/litd_custom_channels_test.go
Outdated
| bobHodlInvoices []assetHodlInvoice | ||
| aliceHodlInvoices []assetHodlInvoice | ||
| assetInvoiceAmt = 100 | ||
| assetInvoiceAmt = 5_000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Bit confused on the math for this change causing MPP to get used.
AFAICT, setting mpp = true below limits the shard size to 80e6 msats / 80000 sats.
But the minted asset seems to be 1,000,000 itest-asset-cents. And it looks like assetInvoiceAmt is denominated in cents also. Not sure if decimal display is being set somewhere I can't find.
I also can't find the exchange rate being used here that would probably help clarify this math.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: I found the rate, from grepping after inspecting the logs, as the config value of mockoracleassetsperbtc. Would still be good to call out.
Also this log msg should be got quote for %d msats, not sats:
lightning-terminal/itest/assets_test.go
Line 1129 in a72e388
| t.Logf("Got quote for %d sats at %v msat/unit from peer %x with SCID "+ |
So, the quoted sat amount is ~85901 sats, which is over the MPP shard threshold of 80000 sats / 4656 asset units.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, that's not super apparent. Added a comment to describe that, which then also makes the use of the mpp variable a bit more apparent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't grok this either. Thanks for explaining it @jharveyb.
go.mod
Outdated
| github.com/lightninglabs/pool/auctioneerrpc v1.1.2 | ||
| github.com/lightninglabs/pool/poolrpc v1.0.0 | ||
| github.com/lightninglabs/taproot-assets v0.4.2-0.20241125202051-783fb1e5ab03 | ||
| github.com/lightninglabs/taproot-assets v0.4.2-0.20241127150634-c96f36961231 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could bump it now to RC5, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, will do that once the tag is pushed in tapd.
894800d to
81f25b7
Compare
| aliceSweepTransfer := locateAssetTransfers( | ||
| t.t, aliceTap, sweepTx.TxHash(), | ||
| ) | ||
| t.Logf("Alice's first-level sweep transfer: %v", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
This if-else statement could be extracted into its own function, with a string parameter for the Logf statement. This prevents the code duplication that is going on in this test.
Updates the force close HTLC sweep integration test to also do MPP payments, to make sure duplicate script keys due to identical MPP shard HTLCs don't cause an issue.